from sqlalchemy import Column, ForeignKey
from sqlalchemy.types import Integer
from sqlalchemy.orm import relationship
from __init__ import Base

class UserGrid(Base):

    __tablename__ = 'usergrid'

    userid = Column(Integer, ForeignKey('users.id'), primary_key=True)
    gridid = Column(Integer, ForeignKey('grids.id'), primary_key=True)
    grid = relationship('Grids')

    def __init__(self, userid, gridid):
        self.userid = userid
        self.gridid = gridid

    def __repr__(self):
        return "<UserGrid('%s', '%s')>" % (self.userid, self.gridid)
